#! /bin/bash
pbkdf2_path=$(cd `dirname $0`; pwd)

# check libcryto.so
if [ ! -d "${pbkdf2_path}/lib/" ];then
    mkdir ${pbkdf2_path}/lib
    echo "Please copy libcryto.so to the folder ${pbkdf2_path}/lib."
    exit 1
fi

if [ ! -f "${pbkdf2_path}/lib/libcrypto.so" ];then
    echo "Please copy libcryto.so to the folder ${pbkdf2_path}/lib."
    exit 1
fi

# pbkdf2
cd  ${pbkdf2_path}/
echo start build pbkdf2
cjpm build -V
cp ${pbkdf2_path}/lib/*.so ${pbkdf2_path}/target/release/pbkdf2/
echo end build pbkdf2